﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Ex03.GarageLogic
{
    public class Bus : Vehicle
    {
        private int m_BusMaximumPassengersAmountAllowed;
        private bool m_BusTourGuideSeatPresent;

        public Bus(
            string i_BusModelName,
            string i_BusLicenseNumber,
            int i_BusWheelAmount,
            float i_BusWheelMaximumAirPressure,
            int i_BusMaximumPassengersAmountAllowed,
            bool i_BusTourGuideSeatPresent)
            : base(
            i_BusModelName,
            i_BusLicenseNumber,
            i_BusWheelAmount,
            i_BusWheelMaximumAirPressure)
        {
            if (!isBusMaximumPassengersAmountLegal(i_BusMaximumPassengersAmountAllowed))
            {
                ArgumentException BusPassengersAmountError = new ArgumentException();

                throw BusPassengersAmountError;
            }
            else
            {
                m_BusTourGuideSeatPresent = i_BusTourGuideSeatPresent;
                m_BusMaximumPassengersAmountAllowed = i_BusMaximumPassengersAmountAllowed;
            }
        }

        private bool isBusMaximumPassengersAmountLegal(int i_BusMaximumPassengersAmountAllowed)
        {
            bool ReturnValue = false;

            if (i_BusMaximumPassengersAmountAllowed > 0)
            {
                ReturnValue = true;
            }

            return ReturnValue;
        }

        public int BusMaximumPassengersAmount
        {
            get { return m_BusMaximumPassengersAmountAllowed; }
            set
            {
                if (!isBusMaximumPassengersAmountLegal(value))
                {
                    ArgumentException BusPassengersAmountError = new ArgumentException();

                    throw BusPassengersAmountError;
                }
                else
                {
                    m_BusMaximumPassengersAmountAllowed = value;
                }
            }
        }

        public bool BusTourGuideSeatPresent
        {
            get { return m_BusTourGuideSeatPresent; }
            set { m_BusTourGuideSeatPresent = value; }
        }

        virtual public override bool AddPropulsionMaterial(
            EnergyType.eEnergyType i_PropulsionMaterialType,
            float i_PropulsionMaterialAmountToAdd)
        {
            throw new NotImplementedException();
        }

        //public override List<String> CollectQustionsListToAskUser()
        //{
        //    List<String> Qustions = new List<String>();
        //    Qustions= base.CollectQustionsListToAskUser();
        //    Qustions.Add(String.Format("Enter Maximum Passengers Amount :"));
        //    Qustions.Add(String.Format("Containing Guide Seat :"));
           
        //    return Qustions;
        //}

        //public override void GetStringsFromUserAndUpdateVehicleData(List<String> i_Answers)
        //{
        //    base.GetStringsFromUserAndUpdateVehicleData(i_Answers);
        //    try
        //    {
        //        MaximumPassengersAmount = int.Parse(i_Answers[0]);
        //        if (i_Answers[1].ToUpper() == "Y")
        //        {
        //            m_ContainingGuideSeat = true;
        //        }
        //        else if (i_Answers[1].ToUpper() == "N")
        //        {
        //            m_ContainingGuideSeat = false;
        //        }
        //        else
        //        {
        //            throw new FormatException("Containing Guide Seat Input Wrong");
        //        }
        //    }
        //    catch (FormatException ex)
        //    {
        //        throw new FormatException ("Maximum Passenger Amount Has Invalid Input Format",ex);
        //    }
            
        //    finally
        //    {
        //        i_Answers.RemoveRange(0, 3);
        //    }
        //}

        //public override List<string> GetAllInformation()
        //{
        //    List<String> ReturnValue = null;
        //    ReturnValue = base.GetAllInformation();
        //    if (ReturnValue == null)
        //    {
        //        ReturnValue = new List<String>();
        //    }
            
        //    ReturnValue.Add(String.Format("Maximum Passengers Amount: {0}", MaximumPassengersAmount));
        //    ReturnValue.Add(String.Format("Containing Guide Seat: {0}", ContainingGuideSeat ? "Yes" : "No"));
        //    return ReturnValue;
        //}
    }
}
